package com.aek.aekdroid;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;

public class NetworkReceiver extends BroadcastReceiver {
	public static final String TAG = "NetworkReceiver";

	@Override
	public void onReceive(Context c, Intent i) {
		boolean isNetworkDown = i.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
		if (isNetworkDown) {
			MyLog.d(TAG, "onReceive network connectivity : NOT CONNECTED, stop service");
			// c.stopService(new Intent(c, MatchUpdaterService.class));
			Helper.setAlarm(TAG, c, 0);
		} else {
			MyLog.d(TAG, "onReceive network connectivity : CONNECTED, start service");
			// c.startService(new Intent(c, MatchUpdaterService.class));
			Helper.setAlarm(TAG, c, -1);
		}
	}
}
